var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, i) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var i in e)
              Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
          })(e, i);
      };
      return function (e, i) {
        function n() {
          this.constructor = e;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        t(e, i),
          (e.prototype =
            null === i
              ? Object.create(i)
              : ((n.prototype = i.prototype), new n()));
      };
    })(),
  FactionSettingDialog = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.list_setting_kangItem1.vScrollBarSkin = ""),
        (e.list_setting_kangItem1.selectEnable = !0),
        e.list_setting_kangItem1.on(
          Laya.Event.CLICK,
          e,
          e.onDidClickSettingItem1Action
        ),
        (e.list_setting_kangItem2.vScrollBarSkin = ""),
        (e.list_setting_kangItem2.selectEnable = !0),
        e.list_setting_kangItem2.on(
          Laya.Event.CLICK,
          e,
          e.onDidClickSettingItem2Action
        ),
        (e.text_min_level.restrict = "0-9"),
        e.label_item1_download.on(
          Laya.Event.CLICK,
          e,
          e.onDidClickItem1DownloadAction
        ),
        e.label_item2_download.on(
          Laya.Event.CLICK,
          e,
          e.onDidClickItem1DownloadAction
        ),
        e.btn_fac_setting_sure.on(Laya.Event.CLICK, e, e.onDidClickSure),
        WebSocketService.addListener({
          caller: e,
          code: 1230,
          method: e.onLoadKangPropertySettingData,
        }),
        e
      );
    }
    return (
      __extends(e, t),
      (e.showFacSettingView = function (t) {
        if (
          (null == this.facSettingV &&
            ((this.facSettingV = new e()), (this.facSettingV.zOrder = 1e3)),
          this.facSettingV.popup(!0),
          (this.facSettingV.list_setting_kangItem1.visible = !1),
          (this.facSettingV.list_setting_kangItem2.visible = !1),
          (this.facSettingV.image_fac_setting.visible = !1),
          (this.facSettingV.image_fac_limit_lvl.visible = !1),
          (this.facSettingV.image_fac_yaoqing_award.visible = !1),
          (this.facSettingV.type = t),
          "jiacheng" == t)
        ) {
          if (
            ((this.facSettingV.image_fac_setting.visible = !0),
            (this.facSettingV.label_setting_kang_tips.visible = !0),
            (this.facSettingV.itemArr1 = [
              "物",
              "击",
              "封",
              "乱",
              "围",
              "风",
              "火",
              "毒",
              "雷",
            ]),
            (this.facSettingV.itemArr2 = [
              "物",
              "击",
              "封",
              "乱",
              "围",
              "风",
              "火",
              "毒",
              "雷",
            ]),
            Global.bangpaiFirstKang)
          ) {
            this.facSettingV.label_item1_name.text = Global.bangpaiFirstKang;
            var i = this.facSettingV.itemArr1.indexOf(Global.bangpaiFirstKang);
            i > -1 && this.facSettingV.itemArr1.splice(i, 1);
          }
          if (Global.bangpaiSecondKang) {
            this.facSettingV.label_item2_name.text = Global.bangpaiSecondKang;
            var n = this.facSettingV.itemArr2.indexOf(Global.bangpaiSecondKang);
            n > -1 && this.facSettingV.itemArr2.splice(n, 1);
          }
          for (
            var a = [], s = [], l = void 0, r = void 0, g = 0;
            g < this.facSettingV.itemArr1.length;
            g++
          ) {
            (l = { item_bang1: { text: (o = this.facSettingV.itemArr1[g]) } }),
              a.push(l);
          }
          this.facSettingV.list_setting_kangItem1.dataSource = a;
          for (g = 0; g < this.facSettingV.itemArr2.length; g++) {
            var o = this.facSettingV.itemArr2[g];
            (r = { item_bang2: { text: o } }), s.push(r);
          }
          this.facSettingV.list_setting_kangItem2.dataSource = s;
        } else
          "limitLvl" == t
            ? ((this.facSettingV.text_min_level.text = Global.bangpaiMinLvl),
              (this.facSettingV.image_fac_limit_lvl.visible = !0),
              (this.facSettingV.label_setting_kang_tips.visible = !1))
            : "yaoqingaward" == t &&
              ((this.facSettingV.image_fac_yaoqing_award.visible = !0),
              (this.facSettingV.label_setting_kang_tips.visible = !1));
        return this.facSettingV;
      }),
      (e.prototype.onDidClickSettingItem1Action = function () {
        this.list_setting_kangItem1.visible = !1;
        var t = this.itemArr1[this.list_setting_kangItem1.selectedIndex];
        this.label_item1_name.text = t;
        var e = this.label_item2_name.text;
        this.itemArr2 = ["物", "击", "封", "乱", "围", "风", "火", "毒", "雷"];
        var i = this.itemArr2.indexOf(t);
        i > -1 && this.itemArr2.splice(i, 1),
          t == e && (this.label_item2_name.text = "");
        for (var n, a = [], s = 0; s < this.itemArr2.length; s++) {
          (n = { item_bang2: { text: this.itemArr2[s] } }), a.push(n);
        }
        this.list_setting_kangItem2.dataSource = a;
      }),
      (e.prototype.onDidClickSettingItem2Action = function () {
        this.list_setting_kangItem2.visible = !1;
        var t = this.itemArr2[this.list_setting_kangItem2.selectedIndex];
        this.label_item2_name.text = t;
        var e = this.label_item1_name.text;
        this.itemArr1 = ["物", "击", "封", "乱", "围", "风", "火", "毒", "雷"];
        var i = this.itemArr1.indexOf(t);
        i > -1 && this.itemArr1.splice(i, 1),
          e == t && (this.label_item2_name.text = "");
        for (var n, a = [], s = 0; s < this.itemArr1.length; s++) {
          (n = { item_bang1: { text: this.itemArr1[s] } }), a.push(n);
        }
        this.list_setting_kangItem1.dataSource = a;
      }),
      (e.prototype.onDidClickItem1DownloadAction = function (t) {
        (this.list_setting_kangItem1.visible = !1),
          (this.list_setting_kangItem2.visible = !1),
          "item1" == t.target.name
            ? (this.list_setting_kangItem1.visible = !0)
            : "item2" == t.target.name &&
              (this.list_setting_kangItem2.visible = !0);
      }),
      (e.prototype.onDidClickSure = function () {
        if ("jiacheng" == this.type) {
          if (
            this.label_item1_name.text.length > 0 &&
            this.label_item2_name.text.length > 0
          ) {
            var t = this.getKeyWithKangValue(this.label_item1_name.text),
              e = this.getKeyWithKangValue(this.label_item2_name.text);
            WebSocketService.send({
              c: 1230,
              d: { id: Global.bangpaiID, type: 1, k: t },
            }),
              WebSocketService.send({
                c: 1230,
                d: { id: Global.bangpaiID, type: 2, k: e },
              });
          }
        } else
          "limitLvl" == this.type
            ? this.text_min_level.text.length > 0 &&
              WebSocketService.send({
                c: 1215,
                d: { lvl: this.text_min_level.text },
              })
            : this.type;
        this.close(), ToastView.toastView("设置成功");
      }),
      (e.prototype.onLoadKangPropertySettingData = function () {
        WebSocketService.send({ c: 1126 });
      }),
      (e.prototype.getKeyWithKangValue = function (t) {
        var e = "";
        return (
          "物" == t
            ? (e = "1")
            : "击" == t
            ? (e = "2")
            : "封" == t
            ? (e = "3")
            : "乱" == t
            ? (e = "4")
            : "围" == t
            ? (e = "5")
            : "风" == t
            ? (e = "6")
            : "火" == t
            ? (e = "7")
            : "毒" == t
            ? (e = "8")
            : "雷" == t && (e = "9"),
          e
        );
      }),
      e
    );
  })(ui.FactionController.FactionSettingDialogUI);
